.class public Lcom/philzhu/www/framework/impl/AndroidGraphics;
.super Ljava/lang/Object;
.source "AndroidGraphics.java"

# interfaces
.implements Lcom/philzhu/www/framework/Graphics;


# instance fields
.field assets:Landroid/content/res/AssetManager;

.field canvas:Landroid/graphics/Canvas;

.field dstRect:Landroid/graphics/Rect;

.field frameBuffer:Landroid/graphics/Bitmap;

.field paint:Landroid/graphics/Paint;

.field scaleX:F

.field scaleY:F

.field srcRect:Landroid/graphics/Rect;


# direct methods
.method public constructor <init>(Landroid/content/res/AssetManager;Landroid/graphics/Bitmap;FF)V
    .locals 1
    .parameter "assets"
    .parameter "frameBuffer"
    .parameter "scaleX"
    .parameter "scaleY"

    .prologue
    .line 34
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 31
    new-instance v0, Landroid/graphics/Rect;

    invoke-direct {v0}, Landroid/graphics/Rect;-><init>()V

    iput-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->srcRect:Landroid/graphics/Rect;

    .line 32
    new-instance v0, Landroid/graphics/Rect;

    invoke-direct {v0}, Landroid/graphics/Rect;-><init>()V

    iput-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->dstRect:Landroid/graphics/Rect;

    .line 35
    iput-object p1, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->assets:Landroid/content/res/AssetManager;

    .line 36
    iput-object p2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->frameBuffer:Landroid/graphics/Bitmap;

    .line 37
    new-instance v0, Landroid/graphics/Canvas;

    invoke-direct {v0, p2}, Landroid/graphics/Canvas;-><init>(Landroid/graphics/Bitmap;)V

    iput-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    .line 38
    new-instance v0, Landroid/graphics/Paint;

    invoke-direct {v0}, Landroid/graphics/Paint;-><init>()V

    iput-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->paint:Landroid/graphics/Paint;

    .line 39
    iput p3, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    .line 40
    iput p4, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    .line 41
    return-void
.end method

.method private static scaleFrom(Landroid/graphics/Bitmap;DD)Landroid/graphics/Bitmap;
    .locals 4
    .parameter "bmp"
    .parameter "xscale"
    .parameter "yscale"

    .prologue
    .line 90
    const-wide v2, 0x3fefffeb074a771dL

    cmpl-double v2, p1, v2

    if-lez v2, :cond_0

    const-wide v2, 0x3ff0000a7c5ac472L

    cmpg-double v2, p1, v2

    if-gez v2, :cond_0

    move-object v2, p0

    .line 95
    :goto_0
    return-object v2

    .line 93
    :cond_0
    invoke-virtual {p0}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v2

    int-to-double v2, v2

    mul-double/2addr v2, p1

    double-to-int v1, v2

    .line 94
    .local v1, dstWidth:I
    invoke-virtual {p0}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v2

    int-to-double v2, v2

    mul-double/2addr v2, p3

    double-to-int v0, v2

    .line 95
    .local v0, dstHeight:I
    const/4 v2, 0x1

    invoke-static {p0, v1, v0, v2}, Landroid/graphics/Bitmap;->createScaledBitmap(Landroid/graphics/Bitmap;IIZ)Landroid/graphics/Bitmap;

    move-result-object v2

    goto :goto_0
.end method


# virtual methods
.method public clear(I)V
    .locals 4
    .parameter "color"

    .prologue
    .line 100
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    const/high16 v1, 0xff

    and-int/2addr v1, p1

    shr-int/lit8 v1, v1, 0x10

    const v2, 0xff00

    and-int/2addr v2, p1

    shr-int/lit8 v2, v2, 0x8

    .line 101
    and-int/lit16 v3, p1, 0xff

    .line 100
    invoke-virtual {v0, v1, v2, v3}, Landroid/graphics/Canvas;->drawRGB(III)V

    .line 102
    return-void
.end method

.method public drawHelpInfo(Ljava/lang/String;IIII)V
    .locals 23
    .parameter "text"
    .parameter "x"
    .parameter "y"
    .parameter "width"
    .parameter "height"

    .prologue
    .line 179
    new-instance v15, Landroid/graphics/Paint;

    invoke-direct {v15}, Landroid/graphics/Paint;-><init>()V

    .line 180
    .local v15, paint:Landroid/graphics/Paint;
    const/high16 v19, -0x100

    move-object v0, v15

    move/from16 v1, v19

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setColor(I)V

    .line 181
    const/16 v19, 0x1

    move-object v0, v15

    move/from16 v1, v19

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setAntiAlias(Z)V

    .line 183
    move-object/from16 v0, p0

    iget v0, v0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    move/from16 v19, v0

    const/high16 v20, 0x3f80

    cmpg-float v19, v19, v20

    if-gez v19, :cond_1

    .line 185
    const/high16 v19, 0x4160

    move-object v0, v15

    move/from16 v1, v19

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextSize(F)V

    .line 192
    :goto_0
    move/from16 v0, p4

    int-to-float v0, v0

    move/from16 v19, v0

    move-object/from16 v0, p0

    iget v0, v0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    move/from16 v20, v0

    mul-float v19, v19, v20

    const/high16 v20, 0x3f00

    add-float v19, v19, v20

    move/from16 v0, v19

    float-to-int v0, v0

    move/from16 p4, v0

    .line 193
    move/from16 v0, p5

    int-to-float v0, v0

    move/from16 v19, v0

    move-object/from16 v0, p0

    iget v0, v0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    move/from16 v20, v0

    mul-float v19, v19, v20

    const/high16 v20, 0x3f00

    add-float v19, v19, v20

    move/from16 v0, v19

    float-to-int v0, v0

    move/from16 p5, v0

    .line 194
    new-instance v14, Ljava/util/Vector;

    invoke-direct {v14}, Ljava/util/Vector;-><init>()V

    .line 195
    .local v14, mString:Ljava/util/Vector;
    const/4 v13, 0x0

    .line 197
    .local v13, mRealLine:I
    const/16 v17, 0x0

    .line 198
    .local v17, w:I
    const/4 v10, 0x0

    .line 199
    .local v10, istart:I
    invoke-virtual {v15}, Landroid/graphics/Paint;->getFontMetrics()Landroid/graphics/Paint$FontMetrics;

    move-result-object v7

    .line 200
    .local v7, fm:Landroid/graphics/Paint$FontMetrics;
    move-object v0, v7

    iget v0, v0, Landroid/graphics/Paint$FontMetrics;->descent:F

    move/from16 v19, v0

    move-object v0, v7

    iget v0, v0, Landroid/graphics/Paint$FontMetrics;->top:F

    move/from16 v20, v0

    sub-float v19, v19, v20

    move/from16 v0, v19

    float-to-double v0, v0

    move-wide/from16 v19, v0

    invoke-static/range {v19 .. v20}, Ljava/lang/Math;->ceil(D)D

    move-result-wide v19

    const-wide/high16 v21, 0x4000

    add-double v19, v19, v21

    move-wide/from16 v0, v19

    double-to-int v0, v0

    move v8, v0

    .line 201
    .local v8, fontHeight:I
    div-int v12, p5, v8

    .line 202
    .local v12, mPageLineNum:I
    invoke-virtual/range {p1 .. p1}, Ljava/lang/String;->length()I

    move-result v6

    .line 203
    .local v6, count:I
    const/4 v9, 0x0

    .local v9, i:I
    :goto_1
    if-lt v9, v6, :cond_2

    .line 238
    const/4 v9, 0x0

    const/4 v11, 0x0

    .end local p1
    .local v11, j:I
    :goto_2
    if-lt v9, v13, :cond_6

    .line 247
    :cond_0
    return-void

    .line 189
    .end local v6           #count:I
    .end local v7           #fm:Landroid/graphics/Paint$FontMetrics;
    .end local v8           #fontHeight:I
    .end local v9           #i:I
    .end local v10           #istart:I
    .end local v11           #j:I
    .end local v12           #mPageLineNum:I
    .end local v13           #mRealLine:I
    .end local v14           #mString:Ljava/util/Vector;
    .end local v17           #w:I
    .restart local p1
    :cond_1
    const/high16 v19, 0x41c0

    move-object v0, v15

    move/from16 v1, v19

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setTextSize(F)V

    goto :goto_0

    .line 205
    .restart local v6       #count:I
    .restart local v7       #fm:Landroid/graphics/Paint$FontMetrics;
    .restart local v8       #fontHeight:I
    .restart local v9       #i:I
    .restart local v10       #istart:I
    .restart local v12       #mPageLineNum:I
    .restart local v13       #mRealLine:I
    .restart local v14       #mString:Ljava/util/Vector;
    .restart local v17       #w:I
    :cond_2
    move-object/from16 v0, p1

    move v1, v9

    invoke-virtual {v0, v1}, Ljava/lang/String;->charAt(I)C

    move-result v5

    .line 206
    .local v5, ch:C
    const/16 v19, 0x1

    move/from16 v0, v19

    new-array v0, v0, [F

    move-object/from16 v18, v0

    .line 207
    .local v18, widths:[F
    invoke-static {v5}, Ljava/lang/String;->valueOf(C)Ljava/lang/String;

    move-result-object v16

    .line 208
    .local v16, str:Ljava/lang/String;
    move-object v0, v15

    move-object/from16 v1, v16

    move-object/from16 v2, v18

    invoke-virtual {v0, v1, v2}, Landroid/graphics/Paint;->getTextWidths(Ljava/lang/String;[F)I

    .line 209
    const/16 v19, 0x2a

    move v0, v5

    move/from16 v1, v19

    if-ne v0, v1, :cond_4

    .line 211
    add-int/lit8 v13, v13, 0x1

    .line 212
    move-object/from16 v0, p1

    move v1, v10

    move v2, v9

    invoke-virtual {v0, v1, v2}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v19

    move-object v0, v14

    move-object/from16 v1, v19

    invoke-virtual {v0, v1}, Ljava/util/Vector;->addElement(Ljava/lang/Object;)V

    .line 213
    add-int/lit8 v10, v9, 0x1

    .line 214
    const/16 v17, 0x0

    .line 203
    :cond_3
    :goto_3
    add-int/lit8 v9, v9, 0x1

    goto :goto_1

    .line 218
    :cond_4
    const/16 v19, 0x0

    aget v19, v18, v19

    move/from16 v0, v19

    float-to-double v0, v0

    move-wide/from16 v19, v0

    invoke-static/range {v19 .. v20}, Ljava/lang/Math;->ceil(D)D

    move-result-wide v19

    move-wide/from16 v0, v19

    double-to-int v0, v0

    move/from16 v19, v0

    add-int v17, v17, v19

    .line 219
    move/from16 v0, v17

    move/from16 v1, p4

    if-le v0, v1, :cond_5

    .line 221
    add-int/lit8 v13, v13, 0x1

    .line 222
    move-object/from16 v0, p1

    move v1, v10

    move v2, v9

    invoke-virtual {v0, v1, v2}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v19

    move-object v0, v14

    move-object/from16 v1, v19

    invoke-virtual {v0, v1}, Ljava/util/Vector;->addElement(Ljava/lang/Object;)V

    .line 223
    move v10, v9

    .line 224
    add-int/lit8 v9, v9, -0x1

    .line 225
    const/16 v17, 0x0

    goto :goto_3

    .line 229
    :cond_5
    const/16 v19, 0x1

    sub-int v19, v6, v19

    move v0, v9

    move/from16 v1, v19

    if-ne v0, v1, :cond_3

    .line 231
    add-int/lit8 v13, v13, 0x1

    .line 232
    move-object/from16 v0, p1

    move v1, v10

    move v2, v6

    invoke-virtual {v0, v1, v2}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v19

    move-object v0, v14

    move-object/from16 v1, v19

    invoke-virtual {v0, v1}, Ljava/util/Vector;->addElement(Ljava/lang/Object;)V

    goto :goto_3

    .line 240
    .end local v5           #ch:C
    .end local v16           #str:Ljava/lang/String;
    .end local v18           #widths:[F
    .end local p1
    .restart local v11       #j:I
    :cond_6
    if-gt v11, v12, :cond_0

    .line 244
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    move-object/from16 v19, v0

    invoke-virtual {v14, v9}, Ljava/util/Vector;->elementAt(I)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Ljava/lang/String;

    add-int/lit8 v20, p2, 0xa

    move/from16 v0, v20

    int-to-float v0, v0

    move/from16 v20, v0

    move-object/from16 v0, p0

    iget v0, v0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    move/from16 v21, v0

    mul-float v20, v20, v21

    .line 245
    move/from16 v0, p3

    int-to-float v0, v0

    move/from16 v21, v0

    move-object/from16 v0, p0

    iget v0, v0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    move/from16 v22, v0

    mul-float v21, v21, v22

    mul-int v22, v8, v11

    move/from16 v0, v22

    int-to-float v0, v0

    move/from16 v22, v0

    add-float v21, v21, v22

    .line 244
    move-object/from16 v0, v19

    move-object/from16 v1, p1

    move/from16 v2, v20

    move/from16 v3, v21

    move-object v4, v15

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    .line 238
    add-int/lit8 v9, v9, 0x1

    add-int/lit8 v11, v11, 0x1

    goto/16 :goto_2
.end method

.method public drawHelpTitle(Ljava/lang/String;)V
    .locals 10
    .parameter "text"

    .prologue
    .line 251
    new-instance v2, Landroid/graphics/Paint;

    invoke-direct {v2}, Landroid/graphics/Paint;-><init>()V

    .line 252
    .local v2, paint:Landroid/graphics/Paint;
    const/high16 v6, -0x100

    invoke-virtual {v2, v6}, Landroid/graphics/Paint;->setColor(I)V

    .line 253
    const/4 v6, 0x1

    invoke-virtual {v2, v6}, Landroid/graphics/Paint;->setAntiAlias(Z)V

    .line 254
    iget v6, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    const/high16 v7, 0x3f80

    cmpg-float v6, v6, v7

    if-gez v6, :cond_0

    .line 256
    const/high16 v6, 0x4190

    invoke-virtual {v2, v6}, Landroid/graphics/Paint;->setTextSize(F)V

    .line 263
    :goto_0
    invoke-virtual {v2, p1}, Landroid/graphics/Paint;->measureText(Ljava/lang/String;)F

    move-result v3

    .line 264
    .local v3, titleLen:F
    invoke-virtual {v2}, Landroid/graphics/Paint;->getFontMetrics()Landroid/graphics/Paint$FontMetrics;

    move-result-object v0

    .line 265
    .local v0, fm:Landroid/graphics/Paint$FontMetrics;
    iget v6, v0, Landroid/graphics/Paint$FontMetrics;->descent:F

    iget v7, v0, Landroid/graphics/Paint$FontMetrics;->top:F

    sub-float/2addr v6, v7

    float-to-double v6, v6

    invoke-static {v6, v7}, Ljava/lang/Math;->ceil(D)D

    move-result-wide v6

    const-wide/high16 v8, 0x4000

    add-double/2addr v6, v8

    double-to-int v1, v6

    .line 267
    .local v1, fontHeight:I
    const/high16 v6, 0x4448

    iget v7, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v6, v7

    sub-float/2addr v6, v3

    const/high16 v7, 0x4000

    div-float/2addr v6, v7

    float-to-int v4, v6

    .line 268
    .local v4, x:I
    move v5, v1

    .line 270
    .local v5, y:I
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    int-to-float v7, v4

    int-to-float v8, v5

    invoke-virtual {v6, p1, v7, v8, v2}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    .line 271
    return-void

    .line 260
    .end local v0           #fm:Landroid/graphics/Paint$FontMetrics;
    .end local v1           #fontHeight:I
    .end local v3           #titleLen:F
    .end local v4           #x:I
    .end local v5           #y:I
    :cond_0
    const/high16 v6, 0x41f0

    invoke-virtual {v2, v6}, Landroid/graphics/Paint;->setTextSize(F)V

    goto :goto_0
.end method

.method public drawLine(IIIII)V
    .locals 6
    .parameter "x"
    .parameter "y"
    .parameter "x2"
    .parameter "y2"
    .parameter "color"

    .prologue
    .line 112
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, p5}, Landroid/graphics/Paint;->setColor(I)V

    .line 113
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    int-to-float v1, p1

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v1, v2

    int-to-float v2, p2

    iget v3, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v2, v3

    int-to-float v3, p3

    iget v4, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v3, v4

    int-to-float v4, p4

    iget v5, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v4, v5

    iget-object v5, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->paint:Landroid/graphics/Paint;

    invoke-virtual/range {v0 .. v5}, Landroid/graphics/Canvas;->drawLine(FFFFLandroid/graphics/Paint;)V

    .line 114
    return-void
.end method

.method public drawPixel(III)V
    .locals 4
    .parameter "x"
    .parameter "y"
    .parameter "color"

    .prologue
    .line 106
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, p3}, Landroid/graphics/Paint;->setColor(I)V

    .line 107
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    int-to-float v1, p1

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v1, v2

    int-to-float v2, p2

    iget v3, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v2, v3

    iget-object v3, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, v1, v2, v3}, Landroid/graphics/Canvas;->drawPoint(FFLandroid/graphics/Paint;)V

    .line 108
    return-void
.end method

.method public drawPixmap(Lcom/philzhu/www/framework/Pixmap;FF)V
    .locals 5
    .parameter "pixmap"
    .parameter "x"
    .parameter "y"

    .prologue
    .line 147
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    check-cast p1, Lcom/philzhu/www/framework/impl/AndroidPixmap;

    .end local p1
    iget-object v1, p1, Lcom/philzhu/www/framework/impl/AndroidPixmap;->bitmap:Landroid/graphics/Bitmap;

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v2, p2

    iget v3, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v3, p3

    const/4 v4, 0x0

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V

    .line 148
    return-void
.end method

.method public drawPixmap(Lcom/philzhu/www/framework/Pixmap;II)V
    .locals 5
    .parameter "pixmap"
    .parameter "x"
    .parameter "y"

    .prologue
    .line 142
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    check-cast p1, Lcom/philzhu/www/framework/impl/AndroidPixmap;

    .end local p1
    iget-object v1, p1, Lcom/philzhu/www/framework/impl/AndroidPixmap;->bitmap:Landroid/graphics/Bitmap;

    int-to-float v2, p2

    iget v3, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v2, v3

    int-to-float v3, p3

    iget v4, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v3, v4

    const/4 v4, 0x0

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V

    .line 143
    return-void
.end method

.method public drawPixmap(Lcom/philzhu/www/framework/Pixmap;III)V
    .locals 5
    .parameter "pixmap"
    .parameter "x"
    .parameter "y"
    .parameter "alpha"

    .prologue
    .line 172
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, p4}, Landroid/graphics/Paint;->setAlpha(I)V

    .line 173
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    check-cast p1, Lcom/philzhu/www/framework/impl/AndroidPixmap;

    .end local p1
    iget-object v1, p1, Lcom/philzhu/www/framework/impl/AndroidPixmap;->bitmap:Landroid/graphics/Bitmap;

    int-to-float v2, p2

    iget v3, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v2, v3

    int-to-float v3, p3

    iget v4, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v3, v4

    iget-object v4, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V

    .line 174
    return-void
.end method

.method public drawPixmap(Lcom/philzhu/www/framework/Pixmap;IIII)V
    .locals 8
    .parameter "pixmap"
    .parameter "x"
    .parameter "y"
    .parameter "srcWidth"
    .parameter "srcHeight"

    .prologue
    const/4 v7, 0x0

    const/4 v6, 0x1

    const/high16 v5, 0x3f00

    .line 153
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->dstRect:Landroid/graphics/Rect;

    int-to-float v1, p2

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v1, v2

    add-float/2addr v1, v5

    float-to-int v1, v1

    iput v1, v0, Landroid/graphics/Rect;->left:I

    .line 154
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->dstRect:Landroid/graphics/Rect;

    int-to-float v1, p3

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v1, v2

    float-to-double v1, v1

    const-wide/high16 v3, 0x3fe0

    add-double/2addr v1, v3

    double-to-int v1, v1

    iput v1, v0, Landroid/graphics/Rect;->top:I

    .line 155
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->dstRect:Landroid/graphics/Rect;

    add-int v1, p2, p4

    sub-int/2addr v1, v6

    int-to-float v1, v1

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v1, v2

    add-float/2addr v1, v5

    float-to-int v1, v1

    iput v1, v0, Landroid/graphics/Rect;->right:I

    .line 156
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->dstRect:Landroid/graphics/Rect;

    add-int v1, p3, p5

    sub-int/2addr v1, v6

    int-to-float v1, v1

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v1, v2

    add-float/2addr v1, v5

    float-to-int v1, v1

    iput v1, v0, Landroid/graphics/Rect;->bottom:I

    .line 157
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    check-cast p1, Lcom/philzhu/www/framework/impl/AndroidPixmap;

    .end local p1
    iget-object v1, p1, Lcom/philzhu/www/framework/impl/AndroidPixmap;->bitmap:Landroid/graphics/Bitmap;

    iget-object v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->dstRect:Landroid/graphics/Rect;

    invoke-virtual {v0, v1, v7, v2, v7}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Paint;)V

    .line 159
    return-void
.end method

.method public drawPixmap(Lcom/philzhu/www/framework/Pixmap;IIIIII)V
    .locals 7
    .parameter "pixmap"
    .parameter "x"
    .parameter "y"
    .parameter "srcX"
    .parameter "srcY"
    .parameter "srcWidth"
    .parameter "srcHeight"

    .prologue
    const/4 v6, 0x1

    const/high16 v5, 0x3f00

    .line 126
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->srcRect:Landroid/graphics/Rect;

    int-to-float v1, p4

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v1, v2

    add-float/2addr v1, v5

    float-to-int v1, v1

    iput v1, v0, Landroid/graphics/Rect;->left:I

    .line 127
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->srcRect:Landroid/graphics/Rect;

    int-to-float v1, p5

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v1, v2

    add-float/2addr v1, v5

    float-to-int v1, v1

    iput v1, v0, Landroid/graphics/Rect;->top:I

    .line 128
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->srcRect:Landroid/graphics/Rect;

    add-int v1, p4, p6

    sub-int/2addr v1, v6

    int-to-float v1, v1

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v1, v2

    add-float/2addr v1, v5

    float-to-int v1, v1

    iput v1, v0, Landroid/graphics/Rect;->right:I

    .line 129
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->srcRect:Landroid/graphics/Rect;

    add-int v1, p5, p7

    sub-int/2addr v1, v6

    int-to-float v1, v1

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v1, v2

    add-float/2addr v1, v5

    float-to-int v1, v1

    iput v1, v0, Landroid/graphics/Rect;->bottom:I

    .line 131
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->dstRect:Landroid/graphics/Rect;

    int-to-float v1, p2

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v1, v2

    add-float/2addr v1, v5

    float-to-int v1, v1

    iput v1, v0, Landroid/graphics/Rect;->left:I

    .line 132
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->dstRect:Landroid/graphics/Rect;

    int-to-float v1, p3

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v1, v2

    float-to-double v1, v1

    const-wide/high16 v3, 0x3fe0

    add-double/2addr v1, v3

    double-to-int v1, v1

    iput v1, v0, Landroid/graphics/Rect;->top:I

    .line 133
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->dstRect:Landroid/graphics/Rect;

    add-int v1, p2, p6

    sub-int/2addr v1, v6

    int-to-float v1, v1

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v1, v2

    add-float/2addr v1, v5

    float-to-int v1, v1

    iput v1, v0, Landroid/graphics/Rect;->right:I

    .line 134
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->dstRect:Landroid/graphics/Rect;

    add-int v1, p3, p7

    sub-int/2addr v1, v6

    int-to-float v1, v1

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v1, v2

    add-float/2addr v1, v5

    float-to-int v1, v1

    iput v1, v0, Landroid/graphics/Rect;->bottom:I

    .line 136
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    check-cast p1, Lcom/philzhu/www/framework/impl/AndroidPixmap;

    .end local p1
    iget-object v1, p1, Lcom/philzhu/www/framework/impl/AndroidPixmap;->bitmap:Landroid/graphics/Bitmap;

    iget-object v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->srcRect:Landroid/graphics/Rect;

    iget-object v3, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->dstRect:Landroid/graphics/Rect;

    .line 137
    const/4 v4, 0x0

    .line 136
    invoke-virtual {v0, v1, v2, v3, v4}, Landroid/graphics/Canvas;->drawBitmap(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Paint;)V

    .line 138
    return-void
.end method

.method public drawPixmapInParentCenter(Lcom/philzhu/www/framework/Pixmap;Landroid/graphics/Point;)V
    .locals 5
    .parameter "pixmap"
    .parameter "center"

    .prologue
    const/high16 v4, 0x3f00

    .line 164
    iget v2, p2, Landroid/graphics/Point;->x:I

    invoke-interface {p1}, Lcom/philzhu/www/framework/Pixmap;->getRawWidth()I

    move-result v3

    div-int/lit8 v3, v3, 0x2

    int-to-float v3, v3

    add-float/2addr v3, v4

    float-to-int v3, v3

    sub-int v0, v2, v3

    .line 165
    .local v0, x:I
    iget v2, p2, Landroid/graphics/Point;->y:I

    invoke-interface {p1}, Lcom/philzhu/www/framework/Pixmap;->getRawHeight()I

    move-result v3

    div-int/lit8 v3, v3, 0x2

    int-to-float v3, v3

    add-float/2addr v3, v4

    float-to-int v3, v3

    sub-int v1, v2, v3

    .line 166
    .local v1, y:I
    invoke-virtual {p0, p1, v0, v1}, Lcom/philzhu/www/framework/impl/AndroidGraphics;->drawPixmap(Lcom/philzhu/www/framework/Pixmap;II)V

    .line 167
    return-void
.end method

.method public drawRect(IIIII)V
    .locals 6
    .parameter "x"
    .parameter "y"
    .parameter "width"
    .parameter "height"
    .parameter "color"

    .prologue
    const/4 v5, 0x1

    .line 118
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->paint:Landroid/graphics/Paint;

    invoke-virtual {v0, p5}, Landroid/graphics/Paint;->setColor(I)V

    .line 119
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->paint:Landroid/graphics/Paint;

    sget-object v1, Landroid/graphics/Paint$Style;->FILL:Landroid/graphics/Paint$Style;

    invoke-virtual {v0, v1}, Landroid/graphics/Paint;->setStyle(Landroid/graphics/Paint$Style;)V

    .line 120
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    int-to-float v1, p1

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v1, v2

    int-to-float v2, p2

    iget v3, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v2, v3

    add-int v3, p1, p3

    sub-int/2addr v3, v5

    int-to-float v3, v3

    iget v4, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v3, v4

    add-int v4, p2, p3

    sub-int/2addr v4, v5

    int-to-float v4, v4

    iget v5, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v4, v5

    iget-object v5, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->paint:Landroid/graphics/Paint;

    invoke-virtual/range {v0 .. v5}, Landroid/graphics/Canvas;->drawRect(FFFFLandroid/graphics/Paint;)V

    .line 121
    return-void
.end method

.method public drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V
    .locals 3
    .parameter "text"
    .parameter "x"
    .parameter "y"
    .parameter "paint"

    .prologue
    .line 275
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->canvas:Landroid/graphics/Canvas;

    iget v1, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    mul-float/2addr v1, p2

    iget v2, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    mul-float/2addr v2, p3

    invoke-virtual {v0, p1, v1, v2, p4}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    .line 276
    return-void
.end method

.method public getCenter(Lcom/philzhu/www/framework/Pixmap;FF)Landroid/graphics/Point;
    .locals 4
    .parameter "pixmap"
    .parameter "x"
    .parameter "y"

    .prologue
    const/high16 v3, 0x3f00

    .line 281
    invoke-interface {p1}, Lcom/philzhu/www/framework/Pixmap;->getRawWidth()I

    move-result v2

    div-int/lit8 v2, v2, 0x2

    int-to-float v2, v2

    add-float/2addr v2, p2

    add-float/2addr v2, v3

    float-to-int v0, v2

    .line 282
    .local v0, centerX:I
    invoke-interface {p1}, Lcom/philzhu/www/framework/Pixmap;->getRawHeight()I

    move-result v2

    div-int/lit8 v2, v2, 0x2

    int-to-float v2, v2

    add-float/2addr v2, p3

    add-float/2addr v2, v3

    float-to-int v1, v2

    .line 283
    .local v1, centerY:I
    new-instance v2, Landroid/graphics/Point;

    invoke-direct {v2, v0, v1}, Landroid/graphics/Point;-><init>(II)V

    return-object v2
.end method

.method public getHeight()I
    .locals 1

    .prologue
    .line 293
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->frameBuffer:Landroid/graphics/Bitmap;

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v0

    return v0
.end method

.method public getWidth()I
    .locals 1

    .prologue
    .line 288
    iget-object v0, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->frameBuffer:Landroid/graphics/Bitmap;

    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v0

    return v0
.end method

.method public newPixmap(Ljava/lang/String;Lcom/philzhu/www/framework/Graphics$PixmapFormat;)Lcom/philzhu/www/framework/Pixmap;
    .locals 10
    .parameter "fileName"
    .parameter "format"

    .prologue
    .line 45
    const/4 v1, 0x0

    .line 46
    .local v1, config:Landroid/graphics/Bitmap$Config;
    sget-object v6, Lcom/philzhu/www/framework/Graphics$PixmapFormat;->RGB565:Lcom/philzhu/www/framework/Graphics$PixmapFormat;

    if-ne p2, v6, :cond_1

    .line 47
    sget-object v1, Landroid/graphics/Bitmap$Config;->RGB_565:Landroid/graphics/Bitmap$Config;

    .line 53
    :goto_0
    const/4 v3, 0x0

    .line 54
    .local v3, in:Ljava/io/InputStream;
    const/4 v0, 0x0

    .line 55
    .local v0, bitmap:Landroid/graphics/Bitmap;
    const/4 v5, 0x0

    .line 56
    .local v5, rawWidth:I
    const/4 v4, 0x0

    .line 58
    .local v4, rawHeight:I
    :try_start_0
    iget-object v6, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->assets:Landroid/content/res/AssetManager;

    invoke-virtual {v6, p1}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v3

    .line 59
    invoke-static {v3}, Landroid/graphics/BitmapFactory;->decodeStream(Ljava/io/InputStream;)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 60
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getWidth()I

    move-result v5

    .line 61
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getHeight()I

    move-result v4

    .line 62
    iget v6, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleX:F

    float-to-double v6, v6

    iget v8, p0, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleY:F

    float-to-double v8, v8

    invoke-static {v0, v6, v7, v8, v9}, Lcom/philzhu/www/framework/impl/AndroidGraphics;->scaleFrom(Landroid/graphics/Bitmap;DD)Landroid/graphics/Bitmap;

    move-result-object v0

    .line 63
    if-nez v0, :cond_3

    .line 64
    new-instance v6, Ljava/lang/RuntimeException;

    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "Couldn\'t load bitmap from asset \'"

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 65
    invoke-virtual {v7, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, "\'"

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    .line 64
    invoke-direct {v6, v7}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v6
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 66
    :catch_0
    move-exception v6

    move-object v2, v6

    .line 67
    .local v2, e:Ljava/io/IOException;
    :try_start_1
    new-instance v6, Ljava/lang/RuntimeException;

    new-instance v7, Ljava/lang/StringBuilder;

    const-string v8, "Couldn\'t load bitmap from asset \'"

    invoke-direct {v7, v8}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    .line 68
    invoke-virtual {v7, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    const-string v8, "\'"

    invoke-virtual {v7, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v7

    invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v7

    .line 67
    invoke-direct {v6, v7}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V

    throw v6
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    .line 69
    .end local v2           #e:Ljava/io/IOException;
    :catchall_0
    move-exception v6

    .line 70
    if-eqz v3, :cond_0

    .line 72
    :try_start_2
    invoke-virtual {v3}, Ljava/io/InputStream;->close()V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_1

    .line 76
    :cond_0
    :goto_1
    throw v6

    .line 48
    .end local v0           #bitmap:Landroid/graphics/Bitmap;
    .end local v3           #in:Ljava/io/InputStream;
    .end local v4           #rawHeight:I
    .end local v5           #rawWidth:I
    :cond_1
    sget-object v6, Lcom/philzhu/www/framework/Graphics$PixmapFormat;->ARGB4444:Lcom/philzhu/www/framework/Graphics$PixmapFormat;

    if-ne p2, v6, :cond_2

    .line 49
    sget-object v1, Landroid/graphics/Bitmap$Config;->ARGB_4444:Landroid/graphics/Bitmap$Config;

    goto :goto_0

    .line 51
    :cond_2
    sget-object v1, Landroid/graphics/Bitmap$Config;->ARGB_8888:Landroid/graphics/Bitmap$Config;

    goto :goto_0

    .line 70
    .restart local v0       #bitmap:Landroid/graphics/Bitmap;
    .restart local v3       #in:Ljava/io/InputStream;
    .restart local v4       #rawHeight:I
    .restart local v5       #rawWidth:I
    :cond_3
    if-eqz v3, :cond_4

    .line 72
    :try_start_3
    invoke-virtual {v3}, Ljava/io/InputStream;->close()V
    :try_end_3
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_2

    .line 78
    :cond_4
    :goto_2
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getConfig()Landroid/graphics/Bitmap$Config;

    move-result-object v6

    sget-object v7, Landroid/graphics/Bitmap$Config;->RGB_565:Landroid/graphics/Bitmap$Config;

    if-ne v6, v7, :cond_5

    .line 79
    sget-object p2, Lcom/philzhu/www/framework/Graphics$PixmapFormat;->RGB565:Lcom/philzhu/www/framework/Graphics$PixmapFormat;

    .line 85
    :goto_3
    new-instance v6, Lcom/philzhu/www/framework/impl/AndroidPixmap;

    invoke-direct {v6, v0, p2, v5, v4}, Lcom/philzhu/www/framework/impl/AndroidPixmap;-><init>(Landroid/graphics/Bitmap;Lcom/philzhu/www/framework/Graphics$PixmapFormat;II)V

    return-object v6

    .line 80
    :cond_5
    invoke-virtual {v0}, Landroid/graphics/Bitmap;->getConfig()Landroid/graphics/Bitmap$Config;

    move-result-object v6

    sget-object v7, Landroid/graphics/Bitmap$Config;->ARGB_4444:Landroid/graphics/Bitmap$Config;

    if-ne v6, v7, :cond_6

    .line 81
    sget-object p2, Lcom/philzhu/www/framework/Graphics$PixmapFormat;->ARGB4444:Lcom/philzhu/www/framework/Graphics$PixmapFormat;

    goto :goto_3

    .line 83
    :cond_6
    sget-object p2, Lcom/philzhu/www/framework/Graphics$PixmapFormat;->ARGB8888:Lcom/philzhu/www/framework/Graphics$PixmapFormat;

    goto :goto_3

    .line 73
    :catch_1
    move-exception v7

    goto :goto_1

    :catch_2
    move-exception v6

    goto :goto_2
.end method
